package com.situ.day3;

import org.junit.Test;

import java.util.Scanner;

public class Demo {
//    ****
//    ****
//    ****
    @Test
    public void test1() {
        //****
        for (int i = 1; i <= 4; i++) {
            System.out.print("*");
        }
        System.out.println();
        System.out.println("-----------");
        for (int i = 1; i <= 3; i++) {
            System.out.println("*");
        }
        System.out.println("------------");
        // i,j,k
        for (int i = 1; i <= 3; i++) {
            for (int j = 1; j <= 4; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

//    *
//    **
//    ***
//    ****
//    *****
    @Test
    public void test3() {
        // i=1,j=1
        // i=2,j=2
        // i=3,j=3
        for (int i = 1; i <= 5; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

    @Test
    public void test13() {
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= i; j++) {
                //豆豆加加
                System.out.print(j+"*"+i+"="+(i*j)+"\t");
            }
            System.out.println();
        }
    }

    @Test
    public void test66() {
        int num = 2;
        if (num == 1) {
            System.out.println("1");
        } else if (num == 2) {
            System.out.println("2");
        } else if (num == 3) {
            System.out.println("3");
        } else {
            System.out.println("else");
        }
    }

    @Test
    public void test7() {
        int num = 4;
        switch (num) {
            case 1:
                System.out.println("1");
                break;
            case 2:
                System.out.println("2");
                break;
            case 3:
                System.out.println("3");
                break;
            case 4:
                System.out.println("4");
                break;
            default:
                System.out.println("default");
        }
    }

    //   >=90   <=100   优秀
    //   >=80    <90       良好
    //   >=70    <80       一般
    //   >=60    <70      及格
    //   <60                   不及格
    @Test
    public void test67() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入成绩：");
        int score = scanner.nextInt();
        switch (score / 10) {
            case 9:
            case 10:
                System.out.println("优秀");
                break;
            case 8:
                System.out.println("良好");
                break;
            case 7:
                System.out.println("一般");
                break;
            case 6:
                System.out.println("及格");
                break;
            default:
                System.out.println("不及格");
                break;
        }
    }

//    输入月份、年份判断天数：
//    1、3、5、7、8、10、12  -------- 31天
//    4、6 、9、11--------------------30天
//    2----------------------------------28/29天
    @Test
    public void test99() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入月份：");
        int month = scanner.nextInt();
        switch (month) {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                System.out.println("31天");
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                System.out.println("30天");
                break;
            case 2:
                System.out.println("请输入年份：");
                int year = scanner.nextInt();
                if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
                    System.out.println("29天");
                } else {
                    System.out.println("28天");
                }
                break;
        }
    }

}
